class Solution:
    def waysToMakeFair(self, nums: list) -> int:
        even = [0 for _ in range(len(nums))]
        odd = [0 for _ in range(len(nums))]
        even[0] = nums[0]
        for i in range(1, len(nums)):
            even[i] = even[i - 1]
            odd[i] = odd[i - 1]
            if i % 2 == 0:
                even[i] += nums[i]
            else:
                odd[i] += nums[i]
        ans = 0
        for i in range(len(nums)):
            oddVal = even[-1] - even[i]
            evenVal = odd[-1] - odd[i]
            if i != 0:
                oddVal += odd[i - 1]
                evenVal += even[i - 1]
            if oddVal == evenVal:
                ans += 1

        return ans
